<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./font_sknr33rvo6b/iconfont.css">
    <link rel="stylesheet" href="./css/shouye.css">
    <link rel="stylesheet" href="./css/denglu.css">
</head>
<body>
    <div class="dtou">
        <a href="#">
            <img src="./img/TB1_Gn8RXXXXXXqaFXXXXXXXXXX-380-54.png" alt="">
        </a>
    </div>
    <div class="dshen">
        <div class="dshen1">
            <img src="./img/11111.png" alt="">
            <div class="dkuang">
                <div class="miduan">
                    <a href="javascript:;" style="border-bottom: 2px solid #000;">密码登陆</a>
                    <!-- <a href="javascript:;">免费注册</a> -->
                </div>
                <form action="">
                    <div class="zhanghao">
                        <span class="iconfont icon-gerenzhongxin"></span>
                        <input type="text" placeholder="    会员名/邮箱/手机号" id="username1">
                    </div>
                    <div class="zhanghao">
                        <span class="iconfont icon-suo"></span>
                        <input type="text" placeholder="    请输入登陆密码" id="password1">
                    </div>
                    <div class="dengluy" id="btn1">登陆</div>
                    <div class="wangji">
                        <a href="javascript:;" id="mianfei">免费注册</a>
                        <a href="javascript:;">忘记用户名</a>
                        <a href="javascript:;">忘记密码</a>
                    </div>
                </form>
            </div>
                
            <div class="dkuang yinshen" style="z-index: -1;">
                <div class="miduan">
                    <!-- <a href="javascript:;" style="border-bottom: 2px solid #000;">密码登陆</a> -->
                    <a href="javascript:;" style="border-bottom: 2px solid #000;">免费注册</a>
                </div>
                <form action="">
                    <div class="zhanghao">
                        <span class="iconfont icon-gerenzhongxin"></span>
                        <input type="text" placeholder="    输入您想要的账号" id="username">
                    </div>
                    <div class="zhanghao">
                        <span class="iconfont icon-suo"></span>
                        <input type="text" placeholder="    请输入注册密码" id="password">
                    </div>
                    <div class="dengluy" id="btn">注册</div>
                    <div class="wangji">
                        <!-- <a href="javascript:;">免费注册</a>
                        <a href="javascript:;">忘记用户名</a> -->
                        <a href="javascript:;" class="fanhui">返回登陆</a>
                    </div>
                </form>
            </div>
                
        </div>
    </div>
    <div class="zuidibu"
    style="background-color: white;border-top: none;">
        <div class="zuidi"
        style="background-color: white;">  
            <p>
                <a href="#">关于天猫</a>
                <a href="#">商家服务大厅</a>
                <a href="#">开放平台</a>
                <a href="#">诚聘英才</a>
                <a href="#">联系我们</a>
                <a href="#">网站合作</a>
                <a href="#">法律声明</a>
                <a href="#">隐私权政策</a>
                <a href="#">知识产权</a>
                <a href="#">廉政举报</a>
            </p>
            <p>
                <a href="#">阿里巴巴集团</a>｜
                <a href="#">淘宝网</a>｜
                <a href="#">天猫</a>｜
                <a href="#">聚划算</a>｜
                <a href="#">全球速卖通</a>｜
                <a href="#">阿里巴巴国际交易市场</a>｜
                <a href="#">1688</a>｜
                <a href="#">阿里妈妈</a>｜
                <a href="#">飞猪</a>｜
                <a href="#">阿里云计算</a>｜
                <a href="#">AliOs</a>｜
                <a href="#">阿里通信</a>｜
                <a href="#">万网</a>｜
                <a href="#">高德</a>｜
                <a href="#">UC</a>｜
                <a href="#">友盟</a>｜
                <a href="#">虾米</a>｜
                <a href="#">叮叮</a>｜
                <a href="#">支付宝</a>｜
                <a href="#">阿里安全</a>
            </p>
            <div class="foot">
                <a href="#">增值电信业务经营许可证：浙B2-20110446</a>
                <span>市场名称登记证：工商网市字3301004119号</span>
                <span>出版物网络交易平台服务经营备案证： 新出发浙备字第2019002号</span>
                <br>
                <span>互联网违法和不良信息举报电话：0571-81683755 blxxjb@alibaba-inc.com</span>
                <a href="#">互联网药品信息服务资质证书编号：浙-（经营性）-2017-0005</a>
                <a href="#"><img src="./img/WeChata56b8ce9ce4ea173a6a4af85970d78ea.png" alt="">浙公网安备 33010002000120号</a>
                <br>
                <span>医疗器械网络交易服务第三方平台备案：（浙）网械平台备字[2018]第00002号</span>
                <br>
                <span>浙江省网络食品销售第三方平台提供者备案：浙网食A33010002</span>
                <a href="#">12318举报</a>
                <a href="#">浙B2-20110446-1</a>
                <b>© 2003-2020 TMALL.COM 版权所有</b>
            </div>
        </div>
    </div>
</body>
<script src="./libs/jquery.2.2.4.js"></script>
<script>
    var zhuce=document.querySelector("#mianfei")
    var yinshen=document.querySelector(".yinshen")
    var fanhui=document.querySelector(".fanhui")
    // console.log(fanhui);
    zhuce.addEventListener("click",function(){
      yinshen.style.zIndex="1"  
    })
    fanhui.addEventListener("click",function(){
        yinshen.style.zIndex="-1"  

    })

    //----------------------------------------------
    $("#btn").on("click",function(){
        console.log(1)
        $.ajax({
            url:"./api",
            data:{
                type:"register",
                username:$("#username").val(),
                password:$("#password").val()
            },
            success:res=>{
                console.log(res);
                res=JSON.parse(res)
                if(res.code===1){
                    if(confirm("注册成功，是否跳转到登陆页面？")){
                        yinshen.style.zIndex="-1"  
                    }
                }else{
                    alert(res.title)
                }
            }
        })
    })
    //----------------------------------------------
    $("#btn1").on("click",function(){
        console.log(1)
        $.ajax({
            url:"./api",
            data:{
                type:"login",
                username:$("#username1").val(),
                password:$("#password1").val()
            },
            success:res=>{
                console.log(res);
                res=JSON.parse(res)
                if(res.code===0){
                    if(confirm("用户名不存在，是否去注册页面")){
                        yinshen.style.zIndex="1"
                    }
                }else if(res.code===1){
                    alert(res.title)
                    $("#password1").val("")
                    $("#password1")[0].focus()
                }else if(res.code===2){
                    if(confirm("登陆成功，是否跳转到首页")){
                        location.href="./shouye.html"
                    }
                    sessionStorage.setItem("islogin",JSON.stringify({
                        code:"OK",
                        name:res.data
                    }))
                }
            }
        })
    })
</script>
</html>